﻿using System;
using System.Text.RegularExpressions;
namespace Utils
{
    public class RegexUtils
    {
        /// <summary>
        /// 是不是正确的账号
        /// </summary>
        /// <returns></returns>
        public static bool IsAccount(string account)
        {
            return !string.IsNullOrEmpty(account) && new Regex("^[A-Za-z0-9]{4,12}$").IsMatch(account);
        }

        /// <summary>
        /// 是不是正确的昵称
        /// </summary>
        /// <returns></returns>
        public static bool IsNickName(string nickName)
        {
            return !string.IsNullOrEmpty(nickName) && nickName.Length > 2 && nickName.Length < 8;
        }
    }
}
